/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.moedik.classes;

/**
 *
 * @author LegACy
 */
public class Flight {
    //Raw Data

    protected int m_ID;
    protected int m_Origin;
    protected int m_Destination;
    protected int m_Airline;
    protected int m_Class;
    protected int m_Fare;
    protected long m_Time;
    //Strings
    protected String m_ClassName;
    protected String m_OriginName;
    protected String m_AirlineName;
    protected String m_DestinationName;
    protected String m_Time_Str;
        //Constants
    public static final String FIELD_ID = "id";
    public static final String FIELD_FARE = "fare";
    public static final String FIELD_TIME = "time";
    public static final String FIELD_CLASS = "class_id";
    public static final String FIELD_ORIGIN = "origin_id";
    public static final String FIELD_AIRLINE = "airline_id";
    public static final String FIELD_DESTINATION = "destination_id";

    public Flight() {
        //Default
        m_ID = 1;
        m_Time = 0;
        m_Fare = 0;
        m_Class = 1;
        m_Origin = 1;
        m_Airline = 1;
        m_ClassName = "";
        m_OriginName = "";
        m_AirlineName = "";
        m_DestinationName = "";
        m_Destination = 1;
    }

    public Flight(int id, int origin, int destination, int airline, int classID, int fare, long time) {
        //Default
        this();

        //TODO fix time

        //Set data
        m_ID = id;
        m_Fare = fare;
        m_Time = time;
        m_Origin = origin;
        m_Class = classID;
        m_Airline = airline;
        m_Destination = destination;
    }

    //Getters
    public int getID() {
        return m_ID;
    }

    public int getFare() {
        return m_Fare;
    }

    public long getTime() {
        return m_Time;
    }

    public int getClassID() {
        return m_Class;
    }

    public int getOriginID() {
        return m_Origin;
    }

    public int getAirlineID() {
        return m_Airline;
    }

    public int getDestinationID() {
        return m_Destination;
    }

    //String getters
    public String getClassName() {
        return m_ClassName;
    }

    public String getOrigin() {
        return m_OriginName;
    }

    public String getAirline() {
        return m_AirlineName;
    }

    public String getDestination() {
        return m_DestinationName;
    }

    //Setters
    public void setID(int id) {
        m_ID = id;
    }

    public void setFare(int fare) {
        m_Fare = fare;
    }

    public void setTime(long time) {
        m_Time = time;
    }

    public void setOriginID(int origin) {
        m_Origin = origin;
    }

    public void setClassID(int classID) {
        m_Class = classID;
    }

    public void setAirlineID(int airline) {
        m_Airline = airline;
    }

    public void setDestinationID(int destination) {
        m_Destination = destination;
    }

    //String setters
    public void setClass(String name) {
        m_ClassName = name;
    }

    public void setOrigin(String name) {
        m_OriginName = name;
    }

    public void setAirline(String name) {
        m_AirlineName = name;
    }

    public void setDestination(String name) {
        m_DestinationName = name;
    }

    public String getTimeStr() {
        return m_Time_Str;
    }

    public void setTimeStr(String Time_Str) {
        this.m_Time_Str = Time_Str.substring(0, Time_Str.length()-2);
    }
    
    public String getDate(){
        return this.m_Time_Str.split(" ")[0];
    }
    
    public String getHour(){
        return this.m_Time_Str.split(" ")[1];
    }
}
